package cn.edu.cqupt.mis.ywbd.admin.controller;

import cn.edu.cqupt.mis.ywbd.admin.annotation.AdminLog;
import cn.edu.cqupt.mis.ywbd.admin.dto.ListQuestionDto;
import cn.edu.cqupt.mis.ywbd.admin.service.QuestionService;
import cn.edu.cqupt.mis.ywbd.admin.vo.QuestionListVo;
import cn.edu.cqupt.mis.ywbd.common.util.ReturnMapUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 李国龙
 * @date 2021/4/9
 */
@RestController
public class QuestionController {

    @Autowired
    QuestionService questionService;


    @GetMapping("/listQuestion")
    public Map listQuestion(ListQuestionDto questionDto) {
        return ReturnMapUtil.getSuccessMap(questionService.listQuestion(questionDto));
    }

    @PostMapping("/updateQuestion")
    @AdminLog("修改问题")
    public Map updateQuestion(String describes, String title) {
        return ReturnMapUtil.getSuccessMap(true);
    }

    @GetMapping("/getQuestionById")
    public Map getQuestionById(Integer questionId) {
        return ReturnMapUtil.getSuccessMap(questionService.getQuestionById(questionId));
    }
}
